const util = {
  // 时间处理函数
  timeFormat: (time, format) => {
    let d = new Date(time);
    let YY = d.getFullYear();
    let MM = d.getMonth() > 8 ? d.getMonth() + 1 : '0' + (d.getMonth() + 1)
    let DD = d.getDate() > 9 ? d.getDate() : '0' + d.getDate()
    let hh = d.getHours() > 9 ? d.getHours() : '0' + d.getHours()
    let mm = d.getMinutes() > 9 ? d.getMinutes() : '0' + d.getMinutes()
    let ss = d.getSeconds() > 9 ? d.getSeconds() : '0' + d.getSeconds()
    switch(format) {
      case 'YYYY-MM-DD hh:mm:ss':
        return `${YY}-${MM}-${DD} ${hh}:${mm}:${ss}`
    }
  },
  strLen: () => {
      var str = '';
      for(var i = 0; i<16; i++) {
          str += (Math.floor((Math.random()*15)+1)).toString(16);
      }
      return str;
  }
}


export default util;